package com.hhf.cloud.controller;

import com.hhf.cloud.entities.DtxOrder;
import com.hhf.cloud.entities.Order;
import com.hhf.cloud.resp.ResultData;
import com.hhf.cloud.service.OrderTccService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Daniel-黄海峰
 * @Description
 * @create 2024/3/2 22:15
 */
@RestController
public class OrderTccController {

    @Resource
    private OrderTccService orderTccService;

    /**
     * 创建订单TCC
     * 测试TCC下订单->扣减账户->扣减库存的地址：http://localhost:2001/order/create/tcc?userId=1&productId=1&count=10&money=100
     */
    @GetMapping("/order/create/tcc")
    public ResultData createTCC(DtxOrder order)
    {
        orderTccService.createTCC(order);
        return ResultData.success(order);
    }
}
